home *** CD-ROM | disk | FTP | other *** search
- /***[f*****************************************************************
- * CImgAcc.h -- image Object Access Interface.
- *
- * Copyright 1996 (c) Adobe Systems, Inc. All Rights Reserved
- *
- * Public version
- * $Revision: 1.4 $
- *
- *
- *
- ***f]*****************************************************************/
-
- #ifndef __CIMGACC_H
- #define __CIMGACC_H
-
- typedef struct _PMImageObjAttr {
- unsigned short isIndexed : 1; // is indexed image ==> has color map
- unsigned short isHifi : 1; // is multi-ink image
- unsigned short hasAlpha : 1; // has alpha sample
- unsigned short isColorManaged : 1; // color managed image (with ICC profile)
- unsigned short isGray : 1; // is grayscale image
- unsigned short unused : 11;
-
- unsigned short photo; // photometric interpretation
-
- unsigned long imageWidth; // image width in pixel
- unsigned long imageLength; // image height in pixel
- // crop rect in image space dimension
- unsigned long startingCol; // starting pix in row
- unsigned long nCols; // number of pixels
- unsigned long startingRow; // starting scanned line
- unsigned long nRows; // number of scanned lines
-
- double xRes; // x resolution in dpi
- double yRes; // y resolution in dpi
-
- char pluginType[4];
- char mediaType[4];
- } PMImageObjAttr;
-
- ////////////////////////////////////////////////////////////////////////
- // IMAGEDATAOPTIONS
- //
- // DESCRIPTION:
- // These are options for accessing images pixel data:
- //
- // kImageAttributeOnly Setup image for attributes access only, i.e.
- // will not try to acces image pixel data. Use this
- // option whenever image pixel data access will not be
- // needed. This will speed up setup process.
- // If this is set then all option flags related to
- // actual image data format will be ignored.
- // kKeepImageBitdepth The pixel data returned will be in its original
- // bitdepth. The default is to expand data to 8-bit
- // samples. When data are expanded to 8-bit samples:
- // 1. Contone data will be interpolated so that 0 is
- // mapped to 0 and 15 is mapped to 255 for 4-bit data.
- // 2. Indexed data kept their original values but data
- // are returned as 8-bit samples.
- // kNoAlphaSamples Pixels with alpha samples will be munged. At this
- // point, only the first associated alpha sample is
- // supported. Unassociated data and undefined extra
- // samples are dropped when kNoAlphaSamples is set.
- // kMonoAsBlackZero All contone monochrome data are returned as
- // Black Zero, i.e. 0 means black and (1<<x - 1) is white,
- // where x is the original bitdepth.
- // kBWAsGray 1-bit B&W data is returned as gray data. That is 0
- // is mapped to 0 and 1 is mapped to 255.
- //
- ////////////////////////////////////////////////////////////////////////
-
- typedef unsigned long IMAGEDATAOPTIONS;
- #define kUseStandardDisplay (IMAGEDATAOPTIONS)(1<<0)
- #define kImageAttributeOnly (IMAGEDATAOPTIONS)(1<<1)
- #define kKeepImageBitdepth (IMAGEDATAOPTIONS)(1<<2)
- #define kNoAlphaSamples (IMAGEDATAOPTIONS)(1<<3)
- #define kMonoAsBlackZero (IMAGEDATAOPTIONS)(1<<4)
- #define kBWAsGray (IMAGEDATAOPTIONS)(1<<5)
-
- #ifdef __cplusplus
- class CIImageObject : public CIInterface
- {
- public:
- virtual ~CIImageObject() {};
-
- // Set up to do image object access.
- virtual PMXErr Setup( PMOBJ_REC* pObjRec, unsigned long options ) = 0;
-
- // Make sure this is called when finished.
- virtual void Finished() = 0;
-
- // Get image object attributes. Setup() must be called first.
- virtual PMXErr GetImageAttr( PMImageObjAttr* pImObjAttr ) = 0;
-
- // Set row data access options. The option flags defined above can be or'ed
- // together.
- virtual PMXErr SetImageRowDataOptions( unsigned long options ) = 0;
-
- // Get image bits per sample and sample per pixels
- virtual PMXErr GetImageBitDepth( short *pBPS, short *pSPP ) = 0;
-
- // Get image row pixel data according to the options set.
- virtual PMXErr GetImageRowData( unsigned long startCol, unsigned long startRow,
- unsigned long nCols, unsigned long nRows, char *pBuffer, unsigned long rowOffset ) = 0;
-
- // Get image row pixel data by plane according to the options set
- virtual PMXErr GetImageRowDataByPlane( short whichPlane, unsigned long startCol, unsigned long startRow,
- unsigned long nCols, unsigned long nRows, char *pBuffer, unsigned long rowOffset ) = 0;
-
- // Get image first alpha channel data according to the options set if relevant.
- // If the alpha samples are already munged, i.e. kNoAlphaSamples is set or
- // if image does not have any, then alpha samples will not be returned.
- virtual PMXErr GetImageFirstAlphaSamples( unsigned long startCol, unsigned long startRow,
- unsigned long nCols, unsigned long nRows, char *pBuffer, unsigned long rowOffset ) = 0;
-
- // The following interfaces require two-pass calls.
- // The first call to get the size. If size > 0, caller allocate buffer of size
- // The second call with the allocated buffer will return the desired information.
-
- // Get image's instrinsic color map:
- // 1. full color images, there is no color map so *pSize = 0.
- // 2. indexed images, the color map.
- // 3. grayscale images, grayscale ramp according to the photometric
- // interpretation and/or the setting of kMonoAsBlackZero.
- // The color map returned in a TIFF style map where color entries are
- // arranged as planar data. Each color component is a short.
- virtual PMXErr GetImageColorMap( long *pSize, char *pColorMap ) = 0;
-
- // Get image's unflatten ICC profile if image is color managed.
- // When image is not color managed, *pSize = 0;
- virtual PMXErr GetImageProfile( long *pSize, char *pProfile ) = 0;
-
- // Get image's instrinsic ink attributes (valid only for hifi image).
- // If image is not a hifi image *pCount = 0, other *pCount indicate the number
- // of inks.
- // Each ink name is a fixed length of 255 chars.
- virtual PMXErr GetImageIntrinsicInkAttr( long *pCount, char *pInkNames ) = 0;
-
- // Sets image's mediaType and pluginType fields. The mediaType defines the type of media
- // the image represents (ex: 'moov' for QuickTime movie). The pluginType defines the
- // preferred plugin for double-click editing of the media image (ex: 'QTFP' for QuickTime
- // Media Plugin).
- // To NOT set one of the types, pass in a null pointer.
- // Therefore the mediaType and pluginType must be either null or a
- // pointer to a 4-byte character array.
- virtual PMXErr SetImageMediaAndPluginTypes( char *mediaType, char *pluginType ) = 0;
- };
-
- #endif // __cplusplus
- #endif // __CIMGACC_H
-